/**
 * Created by IntelliJ IDEA.
 * User: Liu Yuhong
 * Date: 12-10-25
 * Time: 下午5:05
 * Subpage tender page functions.
 */

$(function() {
   
    var menuGroups = [
        {
            'menuId': "tenderMenu",
            'menuTitle': getLanMsg("0ec22400-000055"),
            'iconImg': null,
            'needShow': bModuleSCM_IC,
            'items': [               
                {
                    'itemId': "tenderMenuItem1",                  
                    "itemUrl": "/ebvp/other/nowStorageList",
                    'itemName': getLanMsg("0ec22400-000048"),
            		'needShow': bModuleSCM_IC_SYS,             
                    'callback': function() {window.location = "/ebvp/other/nowStorageList"; return false;}
                },
                {
                    'itemId': "tenderMenuItem2",                  
                    "itemUrl": "/ebvp/other/addGoodsApplyList",
                    'itemName': getLanMsg("0ec22400-000049"),
            		'needShow': bModuleSCM_PU && bModuleSCM_IC_EBP_SYS && bStdVersion,            
                    'callback': function() {window.location = "/ebvp/other/addGoodsApplyList";return false;}
                                         
                },
                {
                    'itemId': "tenderMenuItem3",                   
                    "itemUrl": "/ebvp/other/useCountList",
                    'itemName': getLanMsg("0ec22400-000050"),
            		'needShow': bModuleSCM_IC_SYS,           
                    'callback': function() {window.location = "/ebvp/other/useCountList";return false;}
                },
                {
                    'itemId': "tenderMenuItem4",                   
                    "itemUrl": "/ebvp/other/arrGoodsList?menuid=52",
                    'itemName':  getLanMsg("0ec22400-000051"),
            		'needShow': bModuleSCM_IC,             
                    'callback': function() {window.location = "/ebvp/other/arrGoodsList?menuid=52";return false;}
                },
                {
                    'itemId': "tenderMenuItem5",                  
                    "itemUrl": "/ebvp/other/storageList?menuid=53",
                    'itemName':  getLanMsg("0ec22400-000052"),
            		'needShow': bModuleSCM_IC,             
                    'callback': function() {window.location = "/ebvp/other/storageList?menuid=53";return false;}
                },
                {
                    'itemId': "tenderMenuItem6",                    
                    "itemUrl": "/ebvp/other/supInfoList?menuid=51",
                    'itemName':  getLanMsg("0ec22400-000053"),
            		'needShow': bModuleSCM_IC,             
                    'callback': function() {window.location = "/ebvp/other/supInfoList?menuid=51";return false;}
                },
                {
                    'itemId': "tenderMenuItem7",                   
                    "itemUrl": "/ebvp/other/backGoodsHandlerList",
                    'itemName':  getLanMsg("0ec22400-000054"),
            		'needShow': bModuleSCM_IC_SYS,             
                    'callback': function() {window.location = "/ebvp/other/backGoodsHandlerList";return false;}
                                          
                }
            ]
        }
    ];

    /* 左侧菜单栏 */
    $( "#columnLeft" ).UIColumnMenu({
        'menuGroups': menuGroups,
        'menuHeight': heigth,
        'singleGroup': true
    });
    
    $(function() {	
    	if(k==1){
			$( "#tenderMenuItem4" ).parents("ul").find(".current").removeClass("current");
			$( "#tenderMenuItem4" ).addClass("current");
    	}
    	if(k==2){
    		$( "#tenderMenuItem5" ).parents("ul").find(".current").removeClass("current");
    		$( "#tenderMenuItem5" ).addClass("current");
    	}
    	if(k==3){
    		$( "#tenderMenuItem6" ).parents("ul").find(".current").removeClass("current");
    		$( "#tenderMenuItem6" ).addClass("current");
    	}
    	if(k==4){
    		$( "#tenderMenuItem7" ).parents("ul").find(".current").removeClass("current");
    		$( "#tenderMenuItem7" ).addClass("current");
    	}
    	if(k==5){
    		$( "#tenderMenuItem2" ).parents("ul").find(".current").removeClass("current");
    		$( "#tenderMenuItem2" ).addClass("current");
    	}
	 });
    
    
    $( "#addBankAccount1" ).bind('click', function() {
        var records = $("#addrow").children();
        var prevRecord = records.last();
        var newRecord = prevRecord.clone().insertAfter(prevRecord);
        
        newRecord.find("input").each(function() {
            $( this ).parent("label").css({ 'position': "" }).find(".ui-cleaner, .clear, .revert").remove();
            $( this ).removeAttr("required").val("")
                .attr({ 'id': $( this ).attr("id").replace(/\d+$/g, idx) }).css({ 'position': "", 'zIndex': "" }).UITipInside();
        });

        return false;
    });
    
    //$( "#deleterow" ).live('click', function() {
//        if($( this ).parents("tbody").find("tr").length == 1) {
//            alert("Can't delete the only one record");
//        } else {
//            if(confirm("Delete confirm"))
//                $( this ).parents("tr").remove();
//        }

       // if(confirm(getLanMsg("0ec22410-000125"))){
       //     $( this ).parents("tr").remove();
      //  }
       //     return false;
        
   //   })
   
});
